{include 'header.tpl'}
<style>
    tbody td {
        text-align: center;
    }
    tbody .summary td {
        background: #ddd;
        color: red;
    }
    #preview {
        position: absolute;
        border: 1px solid #ccc;
        background: #333;
        padding: 5px;
        display: none;
        color: #fff;
    }
</style>
<form method="get" action="/admin/Channel/list" class="form-inline">
    <table class="fTable">
        <tbody>
        <tr>
            <th>域名</th>
            <td style="width: 150px;">
                <input name="domain" value="{$smarty.get.domain}" style="width: 140px;"  type="text">
            </td>
            <th>状态</th>
            <td style="width: 150px;">
                <select name="status" class="form-control" title="状态">
                    <option value="">--请选择状态--</option>
                    {foreach from=$channel_status item=item key=key}
                        <option value="{$key}" {if $smarty.get.status == $key} selected {/if}>{$item}</option>
                    {/foreach}
                </select>
            </td>
            <td>
                <button class="btn btn-sm btn-default" type="submit">查找</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-success" href="/admin/Channel/modify" rel="ajax">添加</button>
            </td>

        </tr>
        </tbody>
    </table>
</form>
<div class="clearfix" style="height:30px;"></div>
<table class="fTable" style="width: 100%">
    <thead>
    <tr>
        <th >ID</th>
        <th >渠道名</th>
        <th >域名</th>
        <th >日期</th>
        <th >状态</th>
        <th >操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach from=$list item=item}
        <tr>
            <td>{$item.id}</td>
            <td>{$item.channel_name}</td>
            <td>{$item.domain}</td>
            <td>{$item.create_time}</td>
            <td>{$channel_status[$item.status]}</td>
            <td>
                {if $item.status eq 1}<a  href="/admin/Channel/statusModify?id={$item.id}&status=2" >禁用</a>{/if}
                <a href="/admin/Channel/modify?id={$item.id}"  rel="ajax">修改</a>
                <a  onclick="delete_union({$item.id})" href="javascript:;" >删除</a>
            </td>
        </tr>
    {/foreach}



    </tbody>
</table>
{literal}
    <script>
        function delete_union(id){
            var flag = confirm('删除记录，是否继续？');
            if(flag){
                location.href="/admin/Channel/delete?id="+id;
            }
        }


        layui.use(['laydate'], function(){
            var laydate = layui.laydate;
            $('button.checkAll').click(function (e) {
                $('._checkid').each(function () {
                    $(this).prop('checked',true);
                });
            });
            $('button.checkNo').click(function (e) {
                $('._checkid').each(function () {
                    var checked = $(this).prop('checked');
                    $(this).prop('checked',!checked);
                });
            });

        });



    </script>
{/literal}
{include "pager.tpl"}
{include 'footer.tpl'}